<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get the current value for given option</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ldap-get-option" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ldap_get_option</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ldap_get_option</span> &mdash; <span class="dc-title">Get the current value for given option</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ldap-get-option-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ldap_get_option</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter reference">&$retval</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Sets <code class="parameter">retval</code> to the value of the specified option.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ldap-get-option-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">link_identifier</code></dt>

     <dd>

      <p class="para">
       An LDAP link identifier, returned by <span class="function"><a href="ldap_connect.html" class="function">ldap_connect()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">option</code></dt>

     <dd>

      <p class="para">
       The parameter <code class="parameter">option</code> can be one of:
       <table class="doctable informaltable">
        
         <thead>
          <tr>
           <th>Option</th>
           <th>Type</th>
           <th>since</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><strong><code>LDAP_OPT_DEREF</code></strong></td>
           <td>integer</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_SIZELIMIT</code></strong></td>
           <td>integer</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_TIMELIMIT</code></strong></td>
           <td>integer</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_NETWORK_TIMEOUT</code></strong></td>
           <td>integer</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_PROTOCOL_VERSION</code></strong></td>
           <td>integer</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_ERROR_NUMBER</code></strong></td>
           <td>integer</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_DIAGNOSTIC_MESSAGE</code></strong></td>
           <td>integer</td>
           <td class="empty">&nbsp;</td>
          </tr>
 
          <tr>
           <td><strong><code>LDAP_OPT_REFERRALS</code></strong></td>
           <td>bool</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_RESTART</code></strong></td>
           <td>bool</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_HOST_NAME</code></strong></td>
           <td>string</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_ERROR_STRING</code></strong></td>
           <td>string</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_MATCHED_DN</code></strong></td>
           <td>string</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_SERVER_CONTROLS</code></strong></td>
           <td>array</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_CLIENT_CONTROLS</code></strong></td>
           <td>array</td>
           <td class="empty">&nbsp;</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_KEEPALIVE_IDLE</code></strong></td>
           <td>int</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_KEEPALIVE_PROBES</code></strong></td>
           <td>int</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_KEEPALIVE_INTERVAL</code></strong></td>
           <td>int</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CACERTDIR</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CACERTFILE</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CERTFILE</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CIPHER_SUITE</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CRLCHECK</code></strong></td>
           <td>integer</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CRL_NONE</code></strong></td>
           <td>integer</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CRL_PEER</code></strong></td>
           <td>integer</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CRL_ALL</code></strong></td>
           <td>integer</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_CRLFILE</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_DHFILE</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_KEYILE</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_PACKAGE</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_PROTOCOL_MIN</code></strong></td>
           <td>integer</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_RANDOM_FILE</code></strong></td>
           <td>string</td>
           <td>7.1</td>
          </tr>

          <tr>
           <td><strong><code>LDAP_OPT_X_TLS_REQUIRE_CERT</code></strong></td>
           <td>integer</td>
           <td class="empty">&nbsp;</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    
    
     <dt>
<code class="parameter">retval</code></dt>

     <dd>

      <p class="para">
       This will be set to the option value.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ldap-get-option-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ldap-get-option-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5400">
    <p><strong>Example #1 Check protocol version</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;$ds&nbsp;is&nbsp;a&nbsp;valid&nbsp;link&nbsp;identifier&nbsp;for&nbsp;a&nbsp;directory&nbsp;server<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">ldap_get_option</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">LDAP_OPT_PROTOCOL_VERSION</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$version</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Using&nbsp;protocol&nbsp;version&nbsp;</span><span style="color: #0000BB">$version</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Unable&nbsp;to&nbsp;determine&nbsp;protocol&nbsp;version\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.ldap-get-option-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This function is only available when using OpenLDAP 2.x.x OR Netscape
    Directory SDK x.x.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ldap-get-option-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ldap_set_option.html" class="function" rel="rdfs-seeAlso">ldap_set_option()</a> - Set the value of the given option</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>